Skip to content

fix(desktop): scope the mention picker to the current relay's managed agents - #5720

Open
Chessing234 wants to merge 2 commits into
block:mainfrom
Chessing234:fix/mention-picker-current-relay-5488
Open

fix(desktop): scope the mention picker to the current relay's managed agents#5720
Chessing234 wants to merge 2 commits into
block:mainfrom
Chessing234:fix/mention-picker-current-relay-5488

Conversation

@Chessing234

Copy link
Copy Markdown
Contributor

managed-agents.json is one file per install and every record keeps the relay URL its keypair was minted against. Changing a community's relay URL mints new keypairs and appends them without removing the old rows, and useMentions read the whole file — so the @ picker showed one entry per historical relay: three communities'-worth of Fizz/Honey/Bumble under different npubs, all labelled "managed by you · not in channel". None of the stale ones are reachable on the relay the user is connected to.

Filter the list to the active community's relay once, and derive the name, persona-id, and pubkey lookups (and the mentionableAgentPubkeys set built from them) off the scoped list.

managedAgentsForRelay compares canonically via the existing canonicalRelayUrl, so localhost vs 127.0.0.1, a default port, and a trailing slash still match the same relay. It deliberately fails open in two places, each covered by a test:

  • an unknown or unparsable active relay URL returns the list untouched, so a surface that cannot say where it is shows every agent rather than none;
  • a record whose own relayUrl will not parse is kept, so a real agent is never hidden on the strength of a URL we failed to read.

This is the issue's second suggested fix (scope the picker). It does not clean up managed-agents.json — the stale records stay on disk and stay startable from the Agents view, which felt like the wrong thing to decide inside a mention picker. Happy to follow up with the removal/archive path if you would rather fix it at the source.

Verified locally in desktop/: pnpm typecheck, pnpm check, and pnpm test (4721 pass, including the 5 new ones). I did not build or run the Tauri app.

Closes #5488

managed-agents.json is one file per install and every record keeps the
relay URL its keypair was minted against. Changing a community's relay
URL mints new keypairs and appends them without removing the old rows,
so a reader of the whole file sees one entry per historical relay.

Add the pure filter for that. Comparison is canonical, so localhost vs
127.0.0.1, a default port, and a trailing slash still match. An unknown
active relay or an unreadable record URL keeps entries rather than
dropping them: hiding a real agent is worse than showing a stale one.

Refs block#5488

Signed-off-by: Taksh <takshkothari09@gmail.com>
useMentions read the whole managed-agent file, so every keypair minted
against a previous relay URL kept appearing in the @ picker: three
communities' worth of Fizz/Honey/Bumble under different npubs, all
labelled "managed by you - not in channel". None of them are reachable
on the relay the user is connected to, so picking one produces a
mention that cannot be delivered.

Filter the list to the active community's relay once, and derive the
name, persona, and pubkey lookups from the scoped list.

Closes block#5488

Signed-off-by: Taksh <takshkothari09@gmail.com>
@Chessing234
Chessing234 requested a review from a team as a code owner August 13, 2026 00:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Desktop: stale agent identities accumulate in managed-agents.json when relay URL changes

1 participant